home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gekkan Dennou Club 145
/
Gekkan Dennou Club - 2000.6 Vol. 145 (Japan).7z
/
Gekkan Dennou Club - 2000.6 Vol. 145 (Japan) (Track 1).bin
/
games
/
spassion
/
source.lzh
/
SOURCE
/
FuncEnemy
/
BRAIN.C
< prev
next >
Wrap
Text File
|
2000-03-24
|
3KB
|
140 lines
/*
#include <stdio.h>
#include <iocslib.h>
void key_wait( void );
#define BIT(i) (1<<(i))
*/
/*
脳っぽいやつ
*/
#include <xsp2lib.h>
#include "../SPASSION.H"
#include "../player.h"
#include "../enemy.h"
#include "../eshot.h"
#include "../effect.h"
#include "../priority.h"
#include "../sound.h"
#include "../entry.h"
#ifndef NULL
#define NULL ((void *) 0)
#endif
#define PALET_MAIN 0x0A00
static short MoveEnemyBrain( ENEMY *ene );
/*static void TiniEnemyBrain(ENEMY *);*/
static short MoveEnemyBrain(ENEMY *);
/*static void TiniEnemyBrain(ENEMY *);*/
static HIT_XY4 hit_p[8];
static HIT_XY4 hit_o[8];
static HIT_XY4 hit_s[8]={
-12,-12,12,12,
-12,-12,12,12,
-12,-12,12,12,
-12,-12,12,12,
-11,-11,11,11,
-10,-10,10,10,
-9, -9, 9, 9,
-8, -8, 8, 8,
};
static unsigned char seed=0;
void InitEnemyBrainHit( void )
{
short i;
for(i=0;i<8;i++){
hit_p[i].x1=hit_s[i].x1-PLAYER_HIT_X;hit_p[i].y1=hit_s[i].y1-PLAYER_HIT_Y;
hit_p[i].x2=hit_s[i].x2+PLAYER_HIT_X;hit_p[i].y2=hit_s[i].y2+PLAYER_HIT_Y;
hit_o[i].x1=hit_s[i].x1-OPTION_HIT_X;hit_o[i].y1=hit_s[i].y1-OPTION_HIT_Y;
hit_o[i].x2=hit_s[i].x2+OPTION_HIT_X;hit_o[i].y2=hit_s[i].y2+OPTION_HIT_Y;
}
}
void InitEnemyBrain(ENEMY *ene)
{
ene->info = PALET_MAIN | PRIORITY_ZAKO;
ene->vx = (ene->arg>>8 ) * 32768; /* 引数の上位バイトをvxにする */
ene->vy = ((char)(ene->arg&0xFF)) * 32768; /* 引数の下位バイトをvyにする */
ene->hit_p[0] = &hit_p[0];ene->hit_p[1]=NULL;
ene->hit_o[0] = &hit_o[0];ene->hit_o[1]=NULL;
ene->hit_s[0] = &hit_s[0];ene->hit_s[1]=NULL;
ene->hp = 20;
if( rndtable[seed++]>127 )
ene->arg=0;
else
ene->arg=9;
seed&=255;
ene->no_dead = 0;
ene->func_enemy_move = MoveEnemyBrain;
/* ene->func_enemy_tini = TiniEnemyBrain;*/
/* entry_counter_stop = !0;*/ /* エントリーカウンター停止 */
}
static short MoveEnemyBrain( ENEMY *ene )
{
short anim_num,anim_pt;
short pt[]={11,11,11,11,12,13,14,15,-1,16,16,16,16,17,18,19,20,-1};
/* 速度を足して上位ワード(固定整数部)だけ取り出す */
ene->x = ((ene->lx += ene->vx) >> 16);
ene->y = ((ene->ly += ene->vy) >> 16);
ene->pt = obj_obj_b+(anim_pt=pt[ene->arg+(anim_num=(++ene->anim_count)/4)]);
if( anim_pt == -1 ){
ene->pt = obj_obj_b+pt[ene->arg];
ene->anim_count=0;
anim_num=0;
}
ene->hit_p[0] = &hit_p[anim_num];
ene->hit_o[0] = &hit_o[anim_num];
ene->hit_s[0] = &hit_s[anim_num];
#if 0
if(ENE_X < 128){
ene->lx = 128*65536;
ene->ly = 128*65536;
ene->vx = 0;
ene->vy = 0;
}
if( BITSNS(0x04) & BIT(1) ){ /* F */
while( BITSNS(0x04) & BIT(1) );
entry_counter_stop = 0;
return (0);
}
#endif
/* 画面外に出たら消去 */
if( ENE_X < 0 - 32 )
return (0);
/* ダメージを受けた時の処理 */
#if 1
if(ene->damage){
SetSE(SE_DAMAGE); /* 効果音 */
ene->info = PALET_DAMAGE | PRIORITY_BOSS; /*パレット変更*/
if((ene->hp -= ene->damage) <= 0) {
MakeEffect(EFFECT_EXPL, 0, ene->x, ene->y);
SetSE(SE_EXPL_BRAIN); /* 爆発音 */
ene->player->score += 3;
return (0); /* 消去 */
}
ene->damage = 0;
}else
ene->info = PALET_MAIN | PRIORITY_ZAKO;
#endif
xobj_set_st(ene);
return(1);
}
/*
static void TiniEnemyBrain(ENEMY * p)
{
}
*/